package cn.codingstyle.exercise;

import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class Query<T> {
    private List<T> list;

    public Query(List<T> list) {
        this.list = list;
    }

    public List<T> execute(Predicate<T> predicate) {
        return list.stream().filter(predicate).collect(Collectors.toList());
    }
}
